//
//  PLCategoryViewCell.m
//  PerfectLifeTwo
//
//  Created by 黄华强 on 2018/3/2.
//  Copyright © 2018年 PerfectLife. All rights reserved.
//

#import "PLCategoryViewCell.h"

@implementation PLCategoryViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        
        self.cellImageView = [UIImageView new];
        [self.contentView addSubview:self.cellImageView];
        
        //        self.cellImageView.layer.cornerRadius = 8;
        //        self.cellImageView.layer.masksToBounds = YES;
        
        [self.cellImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(self.contentView);
            make.top.mas_equalTo(frame.size.height * 0.2);
            make.height.width.mas_equalTo(SIZE(40));
        }];
        
        self.cellTitleLabel = [UILabel new];
        [self.contentView addSubview:self.cellTitleLabel];
        
        self.cellTitleLabel.textColor = [UIColor darkGrayColor];
        
//        if (frame.size.width * 0.12 >= 20) {
//            self.cellTitleLabel.font = FONT(20);
//        } else {
//            self.cellTitleLabel.font = FONT(frame.size.width * 0.14);
//        }
        self.cellTitleLabel.font = FONT(15);
        
        
        self.cellTitleLabel.numberOfLines = 2;
        self.cellTitleLabel.textAlignment = NSTextAlignmentCenter;
        
        [self.cellTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(self.contentView);
            make.top.mas_equalTo(self.cellImageView.mas_bottom);
            make.width.mas_equalTo(frame.size.width * 0.9);
            make.bottom.mas_equalTo(self.contentView).offset(-8);
        }];
        
    }
    
    return self;
}

@end
